-- Coords
-- create by zouyb
-- 图标相关工具函数

local itemPathRoot = "images/item/";
local itemSmallPathRoot = "images/item_small/";
local attribPathRoot = "images/attrib/"

-- 获取道具图标, 若文件不存在，使用默认图标
function getItemIconPath(filename)
    if nil == filename then
        return itemPathRoot .. "default.png";
    end
    local fullName = itemPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return itemPathRoot .. "default.png";
    end
end

-- 是否存在道具小图标
function haveItemSmallIcon(filename)
    if nil == filename then
        return false;
    end
    local fullName = itemSmallPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return true;
    else
        return false;
    end
end

-- 获取道具小图标, 若文件不存在，使用默认图标
function getItemSmallIconPath(filename)
    if nil == filename then
        return itemSmallPathRoot .. "default.png";
    end
    local fullName = itemSmallPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return itemSmallPathRoot .. "default.png";
    end
end

local areaPathRoot = "images/ui/sub_area/";
-- 获取获取区域列表背景图标， 若文件不存在，使用默认图标
function getSubAreaBgPath(filename)
    if nil == filename then
        return areaPathRoot .. "default.png";
    end

    local fullName = areaPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return areaPathRoot .. "default.png";
    end
end

local areaNameIcon = "images/area/";

function getAreaNameIconPath(filename)
    if getLang() == "en" then
        -- 英文版本需要使用英文资源目录
        areaNameIcon = "images/area_en/";
    else
        areaNameIcon = "images/area/";
    end

    if nil == filename then
        return areaNameIcon .. "default.png";
    end
    local fullName = areaNameIcon..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return areaNameIcon .. "default.png";
    end
end

local locImg = "images/ui/loc/";

function getLocImg(filename)
    if getLang() ~= "zh" then
        locImg = string.format("images/ui/loc_%s/", getLang());
    else
        locImg = "images/ui/loc/";
    end

    if nil == filename then
        return locImg .. "default.png";
    end
    local fullName = locImg..filename..".png";

    -- TODO ios版本显示临时处理下
    if isIosPlatform() then
        if filename == "completed" then
            fullName = locImg .. "ios_completed" .. ".png";
        end
    end

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return locImg .. "default.png";
    end
end

local monsterPathRoot = "images/monster/";
--获取怪物图标, 若文件不存在，使用默认图标
function getMonsterIconPath(filename)
    local fullName = monsterPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return monsterPathRoot .. "default.png";
    end
end

local commonPathRoot = "images/ui/common/";
-- 获取普通路径下的图标
function getCommonIconPath(filename)
    local fullName = commonPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return commonPathRoot .. "default.png";
    end
end


--获取金币图标
function getGoldIconPath()
    return commonPathRoot .. "gem_icon.png";
end

--获取钻石图标
function getMoneyIconPath()
    return commonPathRoot .. "money_icon.png";
end

local skillPathRoot = "images/skill/";

--获取技能图标
function getSkillIconPath(filename)
    local fullName = skillPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return skillPathRoot .. "default.png";
    end
end

--获取专属技能小图标
local skillSmallPathRoot = "images/skill_small/";
function getSmallSkillIconPath(filename)
    local fullName = skillSmallPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return skillSmallPathRoot .. "default.png";
    end
end

--获取职业图标
local careerPathRoot = "images/career/";
function getCareerIconPath(filename)
    local fullName = skillPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return skillPathRoot .. "default.png";
    end
end

local careerPathRoot = "images/career/";
-- 获取宠物职业图标
function getCareerIconPath(filename)
    local fullName = careerPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return careerPathRoot .. "default.png";
    end
end

local statusPathRoot = "images/status/";
-- 获取状态图标
function getStatusIconPath(filename)
    if filename == nil then
        return statusPathRoot .. "default.png";
    end

    local fullName = statusPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return statusPathRoot .. "default.png";
    end
end

-- 获取属性图标
local smallAttribPathRoot = "images/ui/attrib/";
function getSmallAttribIconPath(filename)
    local fullName = smallAttribPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return smallAttribPathRoot .. "default.png";
    end
end

-- 获取大属性图标
local largeAttribPathRoot = "images/ui/attrib_large/";
function getLargeAttribIconPath(filename)
    local fullName = largeAttribPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return largeAttribPathRoot .. "default.png";
    end
end

--获取任务图标
local taskPathRoot = "images/task/";
function getTaskIconPath(filename)
    local fullName = taskPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return itemPathRoot .. "default.png";
    end
end

-- 获取功能图标
local funcIconPathRoot = "images/func_icon/"
function getFuncIconPath(filename)
    local fullName = funcIconPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return funcIconPathRoot .. "default.png";
    end
end

-- 获取机器人图标路径
local robotPathRoot = "images/robot/"
function getRobotIconPath(filename)
    local fullName = robotPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return robotPathRoot .. "default.png";
    end
end

-- 获取机器人天空战图标路径
local robotSkyCityPathRoot = "images/robot_sky_city/"
function getRobotSkyCityIconPath(filename)
    local fullName = robotSkyCityPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return robotSkyCityPathRoot .. "default.png";
    end
end

-- 获取天空之城战斗的英雄图标路径
local heroSkyCityPathRoot = "images/hero_sky_city/"
function getHeroSkyCityIconPath(filename)
    local fullName = heroSkyCityPathRoot..filename..".png";
    if cc.SpriteFrameCache:getInstance():getSpriteFrame(fullName) then
        return fullName;
    else
        return heroSkyCityPathRoot .. "default.png";
    end
end

-- 获取英雄图标路径
local heroPathRoot = "images/hero/"
function getHeroIconPath(filename)
    local fullName = heroPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return heroPathRoot .. "default.png";
    end
end

-- 获取英雄剪影图标路径
local heroSilhouettePathRoot = "images/silhouette/"
function getHeroSilhouetteIconPath(filename)
    local fullName = heroSilhouettePathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return heroSilhouettePathRoot .. "default.png";
    end
end

-- 获取英雄剪影小图标路径
local heroSilhouetteSmallPathRoot = "images/silhouette_small/"
function getHeroSilhouetteSmallIconPath(filename)
    local fullName = heroSilhouetteSmallPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return heroSilhouetteSmallPathRoot .. "default.png";
    end
end

-- 获取英雄大图标路径
local heroLargeIconPathRoot = "images/hero_anima/"
function getHeroLargeIconPath(filename)
    if filename == nil then
        return heroLargeIconPathRoot .. "default.png";
    end

    local fullName = heroLargeIconPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return heroLargeIconPathRoot .. "default.png";
    end
end

-- 获取英雄小图标路径
local heroSmallPathRoot = "images/hero_small/"
function getSmallHeroIconPath(filename)
    local fullName = heroSmallPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return heroSmallPathRoot .. "default.png";
    end
end

-- 获取英雄中图标路径
local heroMiddlePathRoot = "images/hero/"
function getMiddleHeroIconPath(filename)
    local fullName = heroMiddlePathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return heroMiddlePathRoot .. "default.png";
    end
end

-- 获取英雄变身之后的图片路径
local heroShapeChangeRoot = "images/hero_change/";
function getHeroShapeChangeIconPath(filename)
    local fullName = heroShapeChangeRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return nil;
end

-- 获取装备图标路径
local heroPathRoot = "images/equips/"
function getEquipsIconPath(filename)
    local fullName = heroPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return heroPathRoot .. "default.png";
    end
end

-- 获取商品图标路径
local goodsPathRoot = "images/goods/"
function getGoodsIconPath(filename)
    local fullName = goodsPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return goodsPathRoot .. "default.png";
    end
end

-- 获取天赋图标
local talentPathRoot = "images/ui/talent/"
function getTalentIconPath(filename)
    local fullName = talentPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return talentPathRoot .. "default.png";
    end
end

-- 获取迷宫成就的图标
local achivPathRoot = "images/achievement/"
function getAchivIconPath(filename)
    local fullName = achivPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return achivPathRoot .. "default.png";
    end
end

-- 获取地牢名称图标
local dungeonNamePathRoot = "images/area/";

function getDungeonNameIconPath(filename)
    if getLang() == "en" then
        -- 英文版本需要使用英文资源目录
        dungeonNamePathRoot = "images/area_en/";
    else
        dungeonNamePathRoot = "images/area/";
    end

    local fullName = dungeonNamePathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return dungeonNamePathRoot .. "default.png";
    end
end

-- 获取地牢物件图标
local levelItemPathRoot = "images/ui/level/item/"
function getLevelItemIconPath(filename)
    local fullName = levelItemPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return levelItemPathRoot .. "default.png";
    end
end

-- 获取炼金熔炉项图标
local workshopItemPathRoot = "images/workshop/";
function getWorkshopStrengthenIconPath(filename)
    local fullName = workshopItemPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return workshopItemPathRoot .. "default.png";
    end
end

-- 日记奖励类型图标路径
local bonusTypeIconPath = "images/ui/diary/";
function getDiaryBonusIcon(icon)
    local fullName = bonusTypeIconPath..icon..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return bonusTypeIconPath .. "default.png";
    end
end

-- 获取排行榜相关信息
local topListIconPath = "images/ui/toplist/";
function getTopListIcon(icon)
    local fullName = topListIconPath..icon..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return topListIconPath .. "default.png";
    end
end

local workshopPath = "images/ui/workshop/";
-- 获取斥候冈布奥相关路径
function getScoutIconPath(num)
    local scoutPath = workshopPath .. "scout" .. tostring(num) .. ".png";
    return scoutPath;
end

-- 获取炼金熔炉项图标
local workshopPath = "images/ui/workshop/";
function getWorkshopIconPath(filename)
    local fullName = workshopPath..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return workshopPath .. "default.png";
    end
end

-- 根据商品类型获取商品底图
local itemBgIconPath = "images/ui/workshop/";
function getItemBgIcon(icon, disable)
    if not icon then
        return itemBgIconPath .. "frame_bg.png";
    end

    local fullName = itemBgIconPath .. "bg_" .. icon .. ".png";

    if disable == true then
        fullName = itemBgIconPath .. "bg_" .. icon .. "_2.png";
    end

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return itemBgIconPath .. "frame_bg.png";
    end
end

-- 获取功能引导道具弹窗底图
local featureItemIconPath = "images/features/";
function getFeatureItemIconPath(fileName)
    local fullName = featureItemIconPath..fileName..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return featureItemIconPath .. "default.png";
    end
end

-- 获取标题背景图片
local titleBgIconPath = "images/ui/common_bg/";
function getTitleBgIconPath(openType)
    local path;
    if openType == "food" then
        path = titleBgIconPath .. "food.png";
    elseif openType == "pet" then
        path = titleBgIconPath .. "pet.png";
    elseif openType == "upgrade" then
        path = titleBgIconPath .. "upgrade.png";
    elseif openType == "airship" then
        path = titleBgIconPath .. "airship.png";
    else
        path = titleBgIconPath .. openType .. ".png";
    end

    if cc.FileUtils:getInstance():isFileExist(path) then
        return path;
    else
        path = titleBgIconPath .. "pet.png";
    end

    return path;
end

-- 获取小的背景框资源
local frameBgIconPath = "images/ui/frame/";
function getFrameBgIconPath(type, identifier, disable)
    local fullName = frameBgIconPath.. "default.png";
    if disable == true  then
        fullName = frameBgIconPath.."normal_disable.png";
    elseif "pet" == type then
        fullName = frameBgIconPath.."pet.png";
    elseif  "rank" == type then
        fullName = frameBgIconPath.."rank"..identifier..".png";
    else
        fullName = frameBgIconPath..type..".png";
    end

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return frameBgIconPath.. "default.png";
    end
end

-- 获取Buff图标
function getMonsterBuffIconPath(type)
    if type == BUFF_TYPE_HP then
        return "images/ui/common/buff1.png";
    elseif type == BUFF_TYPE_ATTACK then
        return "images/ui/common/buff2.png";
    elseif type == DEBUFF_TYPE_HP then
        return "images/ui/common/debuff1.png";
    elseif type == DEBUFF_TYPE_ATTACK then
        return "images/ui/common/debuff2.png";
    end
end

-- 获取BOSS怪的Buff图标
function getBossBuffIconPath(type)
    if type == BUFF_TYPE_HP then
        return "images/ui/common/boss_buff1.png";
    elseif type == BUFF_TYPE_ATTACK then
        return "images/ui/common/boss_buff2.png";
    elseif type == DEBUFF_TYPE_HP then
        return "images/ui/common/boss_debuff1.png";
    elseif type == DEBUFF_TYPE_ATTACK then
        return "images/ui/common/boss_debuff2.png";
    end
end

-- 获取蒙版的路径
local maskIconPath = "images/ui/mask/";
function getMaskIconPath(fileName)
    local fullName = maskIconPath .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return maskIconPath.. "default.png";
    end
end

-- 获取阵营图标（半透明）
local campIconPath = "images/camp/";
function getCampIconPath(fileName)
    local fullName = campIconPath..fileName..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return campIconPath .. "default.png";
    end
end

-- 获取阵营图标
local campIconPath2 = "images/camp/camp/";
function getCampIconPath2(fileName)
    local fullName = campIconPath2..fileName..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return campIconPath2 .. "default.png";
    end
end

-- 获取阵营小图标
local campSmallIconPath = "images/camp_small/";
function getCampSmallIconPath(fileName)
    local fullName = campSmallIconPath..fileName..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return campSmallIconPath .. "default.png";
    end
end

-- 获取系别小图标
local careerDepartment = "images/career_department/";
function getCareerDepartmentIconPath(fileName)
    local fullName = careerDepartment..fileName..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return careerDepartment .. "default.png";
    end
end

-- 获取国籍图标
local nationalityRoot = "images/nationality/";
local provinceRoot = "images/province/";
function getNationalityIconPath(fileName)
    -- 判断下国内版本还是国外
    local iconRoot;
    if TopM.isInlandType() then
        iconRoot = provinceRoot;
    else
        iconRoot = nationalityRoot;
    end

    if fileName == nil then
        return iconRoot .. "default.png";
    end

    local fullName = iconRoot..fileName..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return iconRoot .. "default.png";
    end
end

-- 获取按钮图标
local buttonIconPath = "images/ui/button/";
function getButtonIconPath(filename)
    local fullName = buttonIconPath .. filename .. ".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return buttonIconPath .. "default.png";
    end
end

-- 获取标签图标
local tabIconPath = "images/ui/tab/";
function getTabIconPath(filename)
    local fullName = tabIconPath .. filename .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return tabIconPath .. "blue.png";
    end
end

-- 获取冈布奥的背景图片
local uiHeroIconPath = "images/ui/hero/";
function getUIHeroIconPath(filename)
    local fullName = uiHeroIconPath .. filename .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return uiHeroIconPath .. "default.png";
    end
end

-- 获取冈布奥的背景图片
local heroBgIconPath = "images/ui/hero_bg/";
function getHeroBgIconPath(filename)
    local fullName = heroBgIconPath .. filename .. ".jpg";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return heroBgIconPath .. "1.jpg";
    end
end

-- 获取夹层迷宫场景图片
local unrealSceneIconPath = "images/unreal_scene/";
function getUnrealSceneIconPath(filename)
    local fullName = unrealSceneIconPath .. filename .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return unrealSceneIconPath .. "default.png";
    end
end

-- 获取系统设置图标
local settingIconPathRoot = "images/ui/setting/";
function getSettingIconPath(type, name)
    local fullName;
    if type == "system" or type == "debug" then
        -- 系统设置/DEBUG
        fullName = settingIconPathRoot .. name .. ".png";
    else
        -- 其他设置
        fullName = settingIconPathRoot .. type .. "_type/" .. name .. ".png";
    end

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return settingIconPathRoot .. "default.png";
    end
end

-- 获取评论界面图标
local commentIconPathRoot = "images/ui/comment/";
function getCommentIconPath(name)
    local fullName;
    fullName = commentIconPathRoot .. name .. ".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return commentIconPathRoot .. "default.png";
    end
end

-- 获取邮件图片
local mailPathRoot = "images/ui/mail/";
function getMailIconPath(filename)
    local fullName = mailPathRoot..filename..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return mailPathRoot .. "default.png";
    end
end

-- 获取传送们图片
local combatPathRoot = "images/ui/combat_stat/";
function getCombatStatIconPath(filename)
    local fullName = combatPathRoot..filename..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return combatPathRoot .. "default.png";
    end
end

-- 获得星星
local symbolPathRoot = "images/ui/symbol/";
function getSymbolIconPath(fileName)
    local fullName = symbolPathRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return symbolPathRoot .. "default.png";
end

-- 获得加载图片
local dailyTaskPathRoot = "images/ui/daily_task/";
function getDailyTaskIconPath(fileName)
    local fullName = dailyTaskPathRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return dailyTaskPathRoot .. "default.png" ;
end

-- 团购冈布奥的信息
local groupPurchaseRoot = "images/market_%s/group_purchase/%s.png"
function getGroupPurchaseIcon(fileName)
    local fullName = string.format(groupPurchaseRoot, getLang(), fileName);
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return string.format(groupPurchaseRoot, "zh", "default");
end

-- 月卡招牌
local groupPurchaseRoot = "images/sign/"
function getSignIcon(fileName)
    local fullName = groupPurchaseRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return groupPurchaseRoot .. "default.png";
end

-- 根据事件ID获取对应图标
local msgReminderRoot = "images/ui/reminder/"
function getReminderIcon(id)
    if id == MsgReminderM.MSG_REMINDER_TYPE_MONSTER then
        return msgReminderRoot .. "monster.png";
    elseif id == MsgReminderM.MSG_REMINDER_TYPE_ACHIEVEMENT then
        return msgReminderRoot .. "achievement.png";
    elseif id == MsgReminderM.MSG_REMINDER_TYPE_EVENT then
        return msgReminderRoot .. "event.png";
    elseif id == MsgReminderM.MSG_REMINDER_TYPE_TASK then
        return msgReminderRoot .. "task.png";
    elseif id == MsgReminderM.MSG_REMINDER_LIMIT_GIFT then
        return msgReminderRoot .. "recharge.png";
    elseif id == MsgReminderM.MSG_REMINDER_TYPE_PAUSE then
        return msgReminderRoot .. "pause.png";
    elseif id == MsgReminderM.MSG_REMINDER_TYPE_MAIL then
        return msgReminderRoot .. "mail.png";
    end

    return msgReminderRoot .. "monster.png";
end

local accountRoot = "images/ui/setting/account/"
-- 获取账号图标路径
function getAccountIconPath(fileName)
    local fullName = accountRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return accountRoot .. "default.png";
end

-- 获取罐子打开图标
function getPuzzleBoxOpenPath(puzzleType)
    -- TODO
    if puzzleType == "gem" then
        return getItemIconPath(1511);
    else
        return getItemIconPath(1512);
    end
end

local skyCityRoot = "images/ui/sky_city/"
-- 获取天空之城图标路径
function getSkyCityPath(fileName)
    local fullName = skyCityRoot .. fileName .. ".png";

    return fullName;
end

local skyCityIconRoot = "images/ui/sky_city/icon/"
-- 获取天空之城图标路径
function getSkyCityIconPath(fileName)
    local fullName = skyCityIconRoot .. fileName .. ".png";
    return fullName;
end

local skyCityTitleCampRoot = "images/ui/sky_city/title_camp/"
-- 获取天空之城图标路径
function getSkyCityTitleCampPath(fileName)
    local fullName = skyCityTitleCampRoot .. fileName .. ".png";
    return fullName;
end

local skyCityGroupCampRoot = "images/ui/sky_city/group_camp/"
-- 获取天空之城图标路径
function getSkyCityGroupCampPath(fileName)
    local fullName = skyCityGroupCampRoot .. fileName .. ".png";
    return fullName;
end

local skyCityTitleAirshipRoot = "images/ui/sky_city/title_airship/"
-- 获取天空之城图标路径
function getSkyCityTitleAirshipPath(fileName)
    local fullName = skyCityTitleAirshipRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end
    return skyCityTitleAirshipRoot .. "default.png";
end

-- 获取浮岛图标
function getSkyCityIslandIconPath(fileName)
    local fullName = skyCityRoot .. "island/" .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end
    return skyCityRoot .. "island/" .. "default.png";
end

local skyActivityRoot = "images/ui/sky_city/sky_activity/"
-- 获取天空活动图标路径
function getSkyAcitivityPath(fileName)
    local fullName = skyActivityRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end
    return skyCityRoot .. "default.png";
end

local mainIconRoot = "images/ui/main/icon/"
-- 获取main路径下的图标路径
function getMainIconPath(fileName)
    local fullName = mainIconRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return mainIconRoot .. "default.png";
end

local airshipImgRoot = "images/airship/"
-- 获取飞艇图片
function getAirShipImgPath(fileName)
    local fullName = airshipImgRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return airshipImgRoot .. "default.png";
end

local airshipBlueprintImgRoot = "images/airship/blueprint/"
-- 获取飞艇蓝图图片
function getAirShipBlueprintImgPath(fileName)
    local fullName = airshipBlueprintImgRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return airshipBlueprintImgRoot .. "default.png";
end

local airshipSilhouetteRoot = "images/airship_silhouette/"
-- 获取飞艇剪影图片
function getAirShipSilhouettePath(fileName)
    local fullName = airshipSilhouetteRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return airshipSilhouetteRoot .. "default.png";
end

local skyCityCombatRoot = "images/ui/sky_city_combat/"
-- 获取天空之城战斗图片
function getSkyCityCombatIconPath(fileName)
    local fullName = skyCityCombatRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return skyCityCombatRoot .. "default.png";
end

local skyCityDeckRoot = "images/ui/sky_city_combat/deck/"
-- 获取天空之城甲板图片
function getSkyCityDeckIconPath(fileName)
    local fullName = skyCityDeckRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return skyCityDeckRoot .. "default.png";
end

local skyCityAttachmentRoot = "images/ui/sky_city_combat/attachment/"
-- 获取天空之城附件图片
function getSkyCityAttachmentIconPath(fileName)
    local fullName = skyCityAttachmentRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return skyCityAttachmentRoot .. "default.png";
end

-- 获取秘宝图标
function getAirShipSkillIconPath(fileName)
    local fullName = airshipImgRoot .. "airship_skill/" .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return airshipImgRoot .. "airship_skill/default.png";
end

-- 获取天空之城战斗的天空图标
local skyCityCombatSkyRoot = "images/ui/sky_city_combat/sky/";
function getSkyCityCombatSkyIconPath(fileName)
    local fullName = skyCityCombatSkyRoot .. fileName .. ".png";
    return fullName;
end

-- 获取天空之城战斗的浮岛图标
local skyCityCombatIslandsRoot = "images/ui/sky_city_combat/islands/";
function getSkyCityCombatIslandsIconPath(fileName)
    local fullName = skyCityCombatIslandsRoot .. fileName .. ".png";
    return fullName;
end

-- 获取时空裂痕图标
local whirlpoolIconPathRoot = "images/ui/sky_city/whirlpool/";
function getWhirlpoolIcon(filename)
    local fullName = whirlpoolIconPathRoot .. filename..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return whirlpoolIconPathRoot .. "camp_1_2.png";
end

-- 获取召唤怪类型图标
function getSummonTypeIconPath(fileName)
    local fullName = "images/summon_type/" .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return "images/summon_type/default.png";
end

local getMercenaryCampRoot = "images/ui/mercenary_camp/";
-- 获取佣兵营地阵营图标
function getMercenaryCampIconPath(fileName)
    local fullName = getMercenaryCampRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end
    return getMercenaryCampRoot .. "default.png";
end

-- 获取佣兵营地罐子使用标题图
function getUseTankIconPath(fileName)
    local fullName = getMercenaryCampRoot .. "tank_use_" .. getLang() .. "/" .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end
    return getMercenaryCampRoot .. "default.png";
end

local uiMarketItemPathRoot = "images/ui/market/"
-- 商城图标
function getUIMarketIconPath(fileName)
    local fullName = uiMarketItemPathRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end
    return uiMarketItemPathRoot .. "baoxiang.png";
end

-- 新版商城图标
local newMarketIconPath = "images/ui/market/newmarket/";
function getNewMarketIconPath(fileName)
    local fullName = newMarketIconPath .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end
    return nil;
end

-- 根据魔法书分页类型获取的消耗图标
local spellIconPath = "images/ui/magic/cost/"
function getSpellCostIcon(spellType)
    local fullName = spellIconPath .. spellType .. ".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return spellIconPath .. "spell.png";
end

-- 根据魔法书分页类型获取的拥有图标
local spellIconPath = "images/ui/magic/own/"
function getSpellOwnIcon(spellType)
    local fullName = spellIconPath .. spellType .. ".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return spellIconPath .. "spell.png";
end

-- 获取天空之城漫画泡泡图标
local cartoonIconRoot = "images/";
function getCartoonIconPath(fileName)
    local fullName = cartoonIconRoot .. fileName .. ".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return spellIconPath .. "default.png";
end

local skyCityRuinsIconRoot = "images/ui/sky_city/ruins/";
-- 获得天空城矿车图标
function getSkyCityRuinsIconPath(fileName)
    local fullName = skyCityRuinsIconRoot .. fileName .. ".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return nil;
end

local relicFunctionPathRoot = "images/ui/sky_city/ruins/function/";
-- 获取遗迹强化项图标
function getRelicFunctionIconPath(filename)
    local fullName = relicFunctionPathRoot..filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return relicFunctionPathRoot .. "default.png";
    end
end

-- 获取掠夺项目背景
function getRelicTypeBg(typeName)
    if typeName == "boss" then
        return skyCityRuinsIconRoot .. "monster.png";
    elseif typeName == "eggs" then
        return skyCityRuinsIconRoot .. "eggs.png";
    elseif typeName == "relic" then
        return skyCityRuinsIconRoot .. "player.png";
    end
    -- 默认
    return skyCityRuinsIconRoot .. "monster.png";
end

-- 掠夺项目图标
function getRelicIcon(filename)
    local fullName = skyCityRuinsIconRoot .. "icon/" .. filename..".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return skyCityRuinsIconRoot .. "icon/boss.png";
    end
end

local treeHouseItemPathRoot = "images/ui/level/treeHouse/"
-- 获取树屋道具
function getTreeHouseItemIconPath(filename)
    local fullName = treeHouseItemPathRoot .. filename..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return treeHouseItemPathRoot .. "default.png";
    end
end

local compoundItemPathRoot = "images/ui/compound/";
-- 获取合成界面图标
function getCompoundItemIconPath(fileName)
    local fullName = compoundItemPathRoot .. fileName..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end
end

-- 获取DEBUG图标
function getDebugItemPath(type)
    -- TODO
    return settingIconPathRoot .. "default.png";
end

-- 获取迷宫上底图标
local dungeonTopIconPath = "images/ui/level/cover/top/"
function getDungeonTopIconPath(filename)
    local fullName = dungeonTopIconPath .. filename..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return dungeonTopIconPath .. "default.png";
    end
end

-- 获取迷宫下底图标
local dungeonBottomIconPath = "images/ui/level/cover/bottom/"
function getDungeonBottomIconPath(filename)
    local fullName = dungeonBottomIconPath .. filename..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return dungeonBottomIconPath .. "default.png";
    end
end
local skyIslandPathRoot = "images/ui/sky_city/sky_island/"
-- 获取天空之城浮岛图片
function getskyIslandIconPath(filename)
    local fullName = skyIslandPathRoot .. filename..".png";

    return fullName;
end

local triggerIconPathRoot = "images/"
-- 获取天空之城浮岛触发事件Icon图片
function getTriggerIconPath(filename)
    local fullName = triggerIconPathRoot .. filename..".png";

    return fullName;
end

local mainActivityPathRoot = "images/ui/main/activity/"
-- 获取主界面大地图活动入口Icon图片
function getActivityEnterIconPath(filename)
    local fullName = mainActivityPathRoot .. filename..".png";

    return fullName;
end

-- 冈布奥显示
local heroImgBgPathRoot = "images/ui/frame/"
function getHeroImgBg(filename)
    local fullName = heroImgBgPathRoot .. filename..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return heroImgBgPathRoot .. "hero_info.png";
    end
end

-- 获得天空boss的图标
local skyBossImgPathRoot = "images/sky_boss_img/"
function getSkyBossImg(filename)
    local fullName = skyBossImgPathRoot .. filename..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return skyBossImgPathRoot .. "556.png";
    end
end

-- 获得国内支付平台图标
local inlandPayIconPath = "images/ui/market/mycard/"
function getInlandPayIcon(filename)
    local fullName = inlandPayIconPath .. filename..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return inlandPayIconPath .. "btn_mycard1.png";
    end
end

-- 获取角标
local cornerImgPathRoot = "images/ui/common/corner/";
function getCornerImg(filename)
    local fullName = cornerImgPathRoot .. filename..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return cornerImgPathRoot .. "training.png";
    end
end

-- 飞艇图鉴资源
local airShipHandBookRoot = "images/ui/sky_city/hand_book/";
function getAirShipHandBookImg(filename)
    local fullName = airShipHandBookRoot .. filename..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return airShipHandBookRoot .. "default.png";
    end
end

-- 飞艇图标路径
function getAirShipBookIconPath(filename)
    local fullName = airShipHandBookRoot .. "ship/" .. filename..".png";

    if cc.SpriteFrameCache:getInstance():getSpriteFrame(fullName) then
        return fullName;
    else
        return airShipHandBookRoot .. "ship/" .. "default.png";
    end
end

-- 飞艇阴影路径
function getAirShipBookShadowPath(filename)
    local fullName = airShipHandBookRoot .. "ship_shadow/" .. filename..".png";

    if cc.SpriteFrameCache:getInstance():getSpriteFrame(fullName) then
        return fullName;
    else
        return airShipHandBookRoot .. "ship_shadow/" .. "default.png";
    end
end

-- 工程学手册资源路径
local engineeringManualRoot = "images/ui/engineering_manual/";
function getEngineeringManualPath(filename)
    local fullName = engineeringManualRoot .. filename..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return engineeringManualRoot .. "default.png";
    end
end

-- 获取定时炸弹的资源路径
local timeBombRoot = "images/ui/level/time_bomb/";
function getTiemBombPath(fileName)
    local fullName = timeBombRoot .. fileName..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return timeBombRoot .. "default.png";
    end
end

-- 获得迷宫拼图图标路径
local puzzleRoot = "images/ui/market/puzzle_item/"
function getDungeonPuzzleIcon(fileName)
     local fullName = puzzleRoot .. fileName..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return puzzleRoot .. "default.png";
    end
end

-- 获取登陆界面资源路径
local loginRoot = "images/ui/login/";
function getLoginIcon(fileName)
     local fullName = loginRoot .. fileName..".jpg";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return loginRoot .. "default.jpg";
    end
end

-- 获取常规活动图标
local rotineRoot = "images/ui/rotine/"
function getRotineIconPath(fileName)
    -- 使用了道具或者属性图标
    if string.startWith(fileName, "item_") then
        local itemFile = string.sub(fileName, string.len("item_") + 1);
        return getItemIconPath(itemFile);
    elseif string.startWith(fileName, "attrib_") then
        local attribFile = string.sub(fileName, string.len("attrib_") + 1);
        return getLargeAttribIconPath(attribFile);
    elseif string.startWith(fileName, "market_") then
        local marketFile = string.sub(fileName, string.len("market_") + 1);
        return getUIMarketIconPath(marketFile);
    end

    local fullName = rotineRoot .. fileName..".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    else
        return loginRoot .. "hoe.png";
    end
end

local mainIconRoot2 = "images/ui/main/"
-- 获取main路径下的图标路径
function getMainIconPath2(fileName)
    local fullName = mainIconRoot2 .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return mainIconRoot2 .. "event.png";
end

local loginBgIconPath  = "images/ui/login/festival/";
-- 获取登录界面背景(节日背景)
function getLoginFestivalBgIconPath(fileName)
    local fullName = loginBgIconPath .. fileName .. ".jpg";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    -- 不需要默认的
    return nil;
end

-- 获取登录界面上层图片(节日用)
function getLoginFestivalUpperIconPath(fileName)
    local fullName = loginBgIconPath .. fileName .. ".png";

    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    -- 不需要默认的
    return nil;
end

local awakeIconRoot = "images/ui/awake/"
-- 获取main路径下的图标路径
function getAwakeIconPath(fileName)
    local fullName = awakeIconRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return awakeIconRoot .. "default.png";
end

local fateChainIconRoot = "images/ui/fate_chain/"
-- 获取fate_chain路径下的图标路径
function getFateChainIconPath(fileName)
    local fullName = fateChainIconRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return fateChainIconRoot .. "heart.png";
end

local fateChainBabyIconRoot = "images/ui/fate_chain/baby/"
-- 获取命运之链宝宝图标路径
function getFateChainBabyIconPath(fileName)
    local fullName = fateChainBabyIconRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return fateChainBabyIconRoot .. "default.png";
end

local textMaskIconRoot = "images/ui/text_mask/"
-- 获取字体蒙版图片
function getTextMaskIconPath(fileName)
    local fullName = textMaskIconRoot .. fileName .. ".png";
    if cc.FileUtils:getInstance():isFileExist(fullName) then
        return fullName;
    end

    return textMaskIconRoot .. "text_mask4.png";
end